Defect detection is an important part of fabric quality control. To make the detection algorithm possess good commonality and high detection accuracy, a dual-scale fabric defect detection algorithm based on sparse coding was proposed. The algorithm combined the advantage of high stability under large-scale and the advantage of high detection sensitivity under small-scale. At first, the dictionaries under large and small scales were obtained through a small-scale over-complete dictionary training method. Then, the projection of detection image block on the over-complete dictionary was used to extract detection characteristics. Finally, the detection results under dual-scale were fused by the means of distance fusion. The algorithm overcame the disadvantage of large computation because of the introduction of dual-scale while using small-scale over-complete dictionary and downsampling the detection image under large-scale. TILDA Textile Texture Data base was used in the experiment. The experimental results show that the algorithm can effectively detect defects on plain, gingham and striped fabric, the comprehensive detection rate achieves 95.9%. And its moderate amount of calculation can satisfy the requirement of industrial real-time detection, so it does have much value of practical application.